package com.tian.core.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Ztree entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "ztree", catalog = "portalservermond")
public class Ztree implements java.io.Serializable {

	// Fields

	private Integer id;
	private Group group;
	private Ztree ztree;
	private String name;
	private Boolean open;
	private String url;
	private String icon;
	private Set<Ztree> ztrees = new HashSet<Ztree>(0);

	// Constructors

	/** default constructor */
	public Ztree() {
	}

	/** minimal constructor */
	public Ztree(Integer id, Group group, String name, Boolean open,
			String url) {
		this.id = id;
		this.group = group;
		this.name = name;
		this.open = open;
		this.url = url;
	}

	/** full constructor */
	public Ztree(Integer id, Group group, Ztree ztree, String name,
			Boolean open, String url, String icon, Set<Ztree> ztrees) {
		this.id = id;
		this.group = group;
		this.ztree = ztree;
		this.name = name;
		this.open = open;
		this.url = url;
		this.icon = icon;
		this.ztrees = ztrees;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "groupid", nullable = false)
	public Group getGroup() {
		return this.group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	public Ztree getZtree() {
		return this.ztree;
	}

	public void setZtree(Ztree ztree) {
		this.ztree = ztree;
	}

	@Column(name = "name", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "open", nullable = false)
	public Boolean getOpen() {
		return this.open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}
	@Column(name = "icon", length = 100)
	public String getIcon() {
		return this.icon;
	}
	@Column(name = "url", nullable = false, length = 100)
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "ztree")
	public Set<Ztree> getZtrees() {
		return this.ztrees;
	}

	public void setZtrees(Set<Ztree> ztrees) {
		this.ztrees = ztrees;
	}

}